<template>
   <div class="shopinfo-content">
       <!-- 上面的tu -->
       <div class="mui-card">
				<div class="mui-card-content">
					<div class="mui-card-content-inner">
                     <spire :lunbitu="nlist"></spire> 
					</div>
				</div>
       </div>
       <!-- 中间的body -->
        <div class="mui-card">
				<div class="mui-card-header">商品：</div>
				<div class="mui-card-content">
						<div class="mui-card-content-inner">
						<p class="price">
                              市场价：<del>￥2133</del> &nbsp;&nbsp;&nbsp;销售价：<span>￥2566</span>
                        </p>
                        <p>
                            购买数量：<numBox @getcount="getcount"></numBox>
                        </p>
                        <p>
                            <mt-button type="primary" size="small">立即购买</mt-button>
                            <mt-button type="danger" size="small" @click="getincar">加入购物车</mt-button>
                        </p>
					</div>
				</div>
			</div>
       <!-- 底部部分 -->
       <div class="mui-card">
				<div class="mui-card-header">商品:</div>
				<div class="mui-card-content">
					<div class="mui-card-content-inner">
						eeeeee
					</div>
				</div>
				<div class="mui-card-footer">商品详情</div>
			</div>
    </div> 
</template>
<script>
import numBox from './shopinfo_num.vue'
import spire from '../subcomponents/spire.vue'
export default {
    data(){
        return{
           id:this.$route.params.id,
           nlist:[],
           count:1,
           list:[]
        }
    },
    created(){
     this.getlist()
     this.getjpg()
    },
    methods:{
          getjpg(){
		 this.$http.get('http://localhost:3030').then(result=>{
			 var pic=JSON.parse(result.bodyText)
			 if(pic.status===0){
				this.nlist=pic.message
			 }else{
				 Toast("没找到图片")
			 }
		 })
	 },
           getlist(){
           this.$http.get("http://localhost:3030/shop").then(result =>{
              if(result.body.status==0){
                var shop=result.body.message[0]
                this.list=shop
              }else{
                
              }
           })
        },
         getincar(){
           var goodsinfo={id:this.id,count:this.count,price:this.list.now,selected:true}
           console.log(goodsinfo)
           this.$store.commit("addcar",goodsinfo)
           
         },
         getcount(count){
             this.count=count
         }
    },
    components:{
       numBox,
       spire 
    }

}
</script>
<style scoped>
.shopinfo-content{
    padding-top: 50px;
    padding-bottom: 50px;
    overflow: hidden;
}
.mui-card-content-inner{
    width: 100%;
}
</style>

